package com.nikkerball.apps.darkhorse.model.base;

import org.hibernate.annotations.Type;
import org.joda.time.DateTime;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;

/**
 * Base Object For Most Darkhorse Objects
 *
 * @author marius (created on 2010-12-12)
 */
@MappedSuperclass
public class BaseObject implements Serializable {

    // ----- class fields -----

    protected static final int USER_COLUMN_SIZE = 50;

    // ----- instance fields -----

    private DateTime createDate;

    private String createUser;

    private int id;

    // ----- public methods -----

    @Type(type = "org.joda.time.contrib.hibernate.PersistentDateTime")
    @Column(name = "CreateDate", nullable = false)
    public DateTime getCreateDate() {
        return this.createDate;
    }

    public void setCreateDate(DateTime createDate) {
        this.createDate = createDate;
    }

    @Column(name = "CreateUser", length = USER_COLUMN_SIZE, nullable = false)
    public String getCreateUser() {
        return this.createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    @Id
    @Column(nullable = false)
    @GeneratedValue(strategy = GenerationType.AUTO)
    public int getId() {
        return this.id;
    }

    public void setId(int id) {
        this.id = id;
    }


}
